<?php
session_start(); 
$conn = oci_connect("gaurav", "gaurav", "xe"); 
//$myblobid = '41';
$cuiid = $_SESSION['username'];
//$cuiid = 'gip2103';
$query = 'SELECT SELFIMAGE FROM CANDIDATE WHERE CUID = :CUID';

          $stmt = oci_parse ($conn, $query);
          oci_bind_by_name($stmt, ':CUID', $cuiid);
          oci_execute($stmt, OCI_DEFAULT);
          $arr = oci_fetch_assoc($stmt);
          $result = $arr['SELFIMAGE']->load();

          // If any text (or whitespace!) is printed before this header is sent,
          // the text won't be displayed and the image won't display properly.
          // Comment out this line to see the text and debug such a problem.
          header("Content-type: image/JPEG");
          echo $result;

          oci_free_statement($stmt);

          oci_close($conn);
?>

